home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / networking / rpcdemo / rm_svcproc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  1.8 KB  |  59 lines

  1. /*
  2.  * Copyright 1992, 1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. /*
  18.  * rminfo_svcproc.c --
  19.  *
  20.  *    This routine performs the "guts" of the rminfo daemon.
  21.  *    It's called from the RPC dispatch routine in rminfo_svc.c
  22.  */
  23.  
  24. #include <sys/param.h>
  25. #include <sys/sysmp.h>
  26. #include <sys/sysmacros.h>
  27. #include <errno.h>
  28. #include <rpc/rpc.h>
  29. #define _RPCGEN_SVC
  30. #include "rminfo.h"
  31.  
  32. rminfo1 *
  33. rminfoproc_get_1(void *v, struct svc_req *rq)
  34. {
  35.     static rminfo1    rm;
  36.     int            rminfosz;
  37.     struct rminfo    ri;
  38.  
  39.     /*
  40.      * Ask the IRIX kernel for the info, then convert the values
  41.      * from pages to bytes.
  42.      */
  43.     rminfosz = sysmp(MP_SASZ, MPSA_RMINFO);
  44.     if (sysmp(MP_SAGET, MPSA_RMINFO, (char *) &ri, rminfosz) < 0)
  45.     return NULL;
  46.     rm.freemem     = ctob(ri.freemem);
  47.     rm.availsmem = ctob(ri.availsmem);
  48.     rm.availrmem = ctob(ri.availrmem);
  49.     rm.bufmem     = ctob(ri.bufmem);
  50.     rm.physmem     = ctob(ri.physmem);
  51.     rm.delwri     = ctob(ri.delwri);
  52.  
  53. #ifdef DEBUG
  54.     printf("free %d, avails %d, availr %d, buf %d, physmem %d, delwri %d\n",
  55.      rm.freemem, rm.availsmem, rm.availrmem, rm.bufmem, rm.physmem, rm.delwri);
  56. #endif
  57.     return &rm;
  58. }
  59.